use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct OA3 {
    #[serde(rename = "ServerBased")]
    pub server_based: Option<ServerBased>,
    #[serde(rename = "OutputData")]
    pub output_data: Option<OutputData>,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ServerBased {
    #[serde(rename = "KeyProviderServerLocation")]
    pub key_provider_server_location: Option<KeyProviderServerLocation>,
    #[serde(rename = "Parameters")]
    pub parameters: Option<Parameters>,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct KeyProviderServerLocation {
    #[serde(rename = "IPAddress")]
    pub ip_address: String,
    #[serde(rename = "ProtocolSequence")]
    pub protocol_sequence: String,
    #[serde(rename = "EndPoint")]
    pub end_point: String,
    #[serde(rename = "Options")]
    pub options: String,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Parameters {
    #[serde(rename = "Parameter", skip_serializing_if = "Option::is_none")]
    pub licensable_part_number: Option<Parameter>,
    #[serde(rename = "OEMOptionalInfo")]
    pub oem_optional_info: Option<OEMOptionalInfo>,
    #[serde(rename = "TrackingInfo")]
    pub tracking_info: String,
    #[serde(rename = "SerialNumber")]
    pub serial_number: String,
    #[serde(rename = "BusinessID")]
    pub business_id: String,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Parameter {
    #[serde(rename = "@name")]
    pub name: String,
    #[serde(rename = "@value")]
    pub value: String,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct OEMOptionalInfo {
    #[serde(rename = "Field")]
    pub fields: Vec<Field>,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Field {
    #[serde(rename = "Name")]
    pub name: String,
    #[serde(rename = "Value")]
    pub value: String,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct OutputData {
    #[serde(rename = "AssembledBinaryFile")]
    pub assembled_binary_file: String,
    #[serde(rename = "ReportedXMLFile")]
    pub reported_xml_file: String,
}

#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FileBasedInputFile {
    #[serde(rename = "ProductKey")]
    pub product_key: String,
    #[serde(rename = "ProductKeyID")]
    pub product_key_id: String,
    #[serde(rename = "ProductKeyState")]
    pub product_key_state: String,
    #[serde(rename = "HardwareHash")]
    pub hardware_hash: Option<String>
}
